<template>
  <div id="app" :style="fontStyle">
    <router-view />
    <!-- <Home></Home> -->
  </div>
</template>

<script>
import { addBuryingPoint } from '@/api/data';
import Home from "../src/views/home";
import pageIcon from '@/mixin/pageIcon.js';
export default {
  components: { Home },
  mixins: [pageIcon],
  name: "App",
  data() {
    return {
      os: this.getOperatingSystem(),
    };
  },
  created () {
    //通用埋点，对接曾辉
    this.$bus.$on('generalReportAction', this.generalReportAction);
  },
  computed: {
    fontStyle() {
      switch (this.os) {
        case "macOS":
          return 'font-family: "PingFang SC", "Microsoft YaHei";';
        case "Windows":
          return 'font-family: "Microsoft YaHei", "PingFang SC";';
        default:
          return "font-family: sans-serif;";
      }
    },
  },
  methods: {
    generalReportAction(params){
      addBuryingPoint(params).then((res)=>{
        if(res.code==200){
      
        }
      }).catch((e)=>{console.log(e)})
    },
    getOperatingSystem() {
      const userAgent = window.navigator.userAgent;
      if (userAgent.indexOf("Mac") !== -1) {
        return "macOS";
      } else if (userAgent.indexOf("Win") !== -1) {
        return "Windows";
      }
      return "unknown";
    },
  },
};
</script>
<style scoped>
@font-face {
  font-family: "title-home-font";
  src: url("../src/assets/font/字魂266号-绅士黑.ttf") format("truetype");
  font-display: swap;
}
</style>
